Exercice N°18
Enoncer:
Écrire un programme qui permet de dessiner cette forme.
Correction :
from turtle import *
fillcolor('red')
begin_fill()
lt(45)
fd(318)
lt(90)
fd(318)
lt(135)
fd(450)
end_fill()
fillcolor('green')
begin_fill()
lt(90)
fd(800)
lt(90)
fd(150)
lt(90)
fd(650)
end_fill()
bk(650)
rt(90)
fd(150)
lt(90)
fd(650)
fillcolor('black')
begin_fill()
bk(650)
rt(90)
fd(150)
lt(90)
fd(800)
end_fill()
color('white')
penup()
goto(95,310)
pendown()
begin_fill()
circle(80)
end_fill()
penup()
goto(97,300)
pendown()
color('red')
begin_fill()
circle(70)
end_fill()
penup()
goto(110,290)
pendown()
color('white')
begin_fill()
circle(60)
end_fill()
penup()
setheading(30)
goto(90,210)
color('red')
begin_fill()
down()
for i in range(5):
forward(60)
left(144)
end_fill()
hideturtle()
